<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui" >
	<!-- 删除客户-->
	<p:confirmDialog id="deleteCustomerDlgID" message="删除将同时删除客户对应的系统帐户,确认删除客户吗?"
		header="删除客户" severity="alert" widgetVar="deleteCustomerDlg">
		<p:commandButton value="确定" update=":form:customerTable" action="#{customerManageAction.deleteCustomer}"
			oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);}deleteCustomerDlg.hide();"  />
		<p:commandButton value="取消" onclick="deleteCustomerDlg.hide()" type="button" />
	</p:confirmDialog>
	<!-- 查看客户 -->
	<p:dialog id="viewCustomerDlgID" header="查看客户" widgetVar="viewCustomerDlg" modal="true" resizable="false" >
		<p:outputPanel id="viewCustomerPanel" style="width: 100%" >
				<table>
					<tr><td>
						<h:outputLabel for="viewCustomerName" value="客户名称："/>
					</td><td>
						<h:outputText id="viewCustomerName" value="#{customerManageAction.viewCustomer.customerName}" styleClass="outputInfoFont"/>
					</td><td>
						<h:outputLabel for="viewCustomerCode" value="客户编码："/>
					</td><td>
						<h:outputText id="viewCustomerCode" value="#{customerManageAction.viewCustomer.customerCode}"  styleClass="outputInfoFont" />
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="viewCustomerLandlinePhone" value="客户座机："/>
					</td><td>
						<h:outputText id="viewCustomerLandlinePhone" value="#{customerManageAction.viewCustomer.customerLandlinePhone}"  styleClass="outputInfoFont"/>
					</td><td>
						<h:outputLabel for="viewCustomerCellphone" value="客户手机："/>
					</td><td>
						<h:outputText id="viewCustomerCellphone" value="#{customerManageAction.viewCustomer.customerCellphone}"  styleClass="outputInfoFont"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="viewCustomerCompany" value="公司名称："/>
					</td><td>
						<h:outputText id="viewCustomerCompany" value="#{customerManageAction.viewCustomer.customerCompany}"   styleClass="outputInfoFont"/>
					</td><td>
						<h:outputLabel for="viewCustomerRegion" value="客户地区："/>
					</td><td>
						<h:outputText id="viewCustomerRegion" value="#{customerManageAction.viewCustomer.customerRegion}"  styleClass="outputInfoFont"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="viewLastOrderWeight" value="最后下单量："/>
					</td><td>
						<h:outputText id="viewLastOrderWeight" value="#{customerManageAction.viewCustomer.lastOrderWeight}"  styleClass="outputInfoFont"/>
					</td><td>
						<h:outputLabel for="viewLastOrderDate" value="最后下单日期："/>
					</td><td>
						<h:outputText id="viewLastOrderDate" value="#{customerManageAction.viewCustomer.lastOrderDate}"   styleClass="outputInfoFont">
							<f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8"/>
						</h:outputText>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="viewCustomerState" value="客户状态："/>
					</td><td>
						<h:selectOneMenu id="viewCustomerState" value="#{customerManageAction.viewCustomer.customerState}" style="width: 100px;font-weight: bold" disabled="true">  
			                <f:selectItems value="#{customerManageAction.customerStateItems}"/>
			            </h:selectOneMenu>
					</td><td>
						<h:outputLabel for="viewTotalOrderWeight" value="累计下单量："/>
					</td><td>
						<h:outputText id="viewTotalOrderWeight" value="#{customerManageAction.viewCustomer.totalOrderWeight}"   styleClass="outputInfoFont"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="viewCustomerDesc" value="备注："/>
					</td><td colspan="3">
						<p:inputTextarea disabled="true" id="viewCustomerDesc" value="#{customerManageAction.viewCustomer.customerDesc}" rows="1" autoResize="false" maxlength="100" style="width:430px" styleClass="outputInfoFont"/>
					</td></tr>
				</table>
		</p:outputPanel>
		<f:facet name="footer">
			<p:commandButton value="确定"  oncomplete="viewCustomerDlg.hide();"  />
		</f:facet>
	</p:dialog>
	<!-- 修改客户 -->
	<p:dialog id="updateCustomerDlgID" header="修改客户" widgetVar="updateCustomerDlg" modal="true" resizable="false" >
		<p:outputPanel id="updateCustomerPanel" style="width: 100%" >
				<table>
					<tr><td>
						<h:outputLabel for="updateCustomerName" value="客户名称："/>
					</td><td>
						<p:inputText id="updateCustomerName" value="#{customerManageAction.updateCustomer.customerName}" maxlength="30"/>
					</td><td>
						<h:outputLabel for="updateCustomerRegion" value="客户地区："/>
					</td><td>
						<p:inputText id="updateCustomerRegion" value="#{customerManageAction.updateCustomer.customerRegion}"  maxlength="50"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="updateCustomerLandlinePhone" value="客户座机："/>
					</td><td>
						<p:inputText id="updateCustomerLandlinePhone" value="#{customerManageAction.updateCustomer.customerLandlinePhone}"  maxlength="20"/>
					</td><td>
						<h:outputLabel for="updateCustomerCellphone" value="客户手机："/>
					</td><td>
						<p:inputText id="updateCustomerCellphone" value="#{customerManageAction.updateCustomer.customerCellphone}"  maxlength="20"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="updateCustomerCompany" value="公司名称："/>
					</td><td>
						<p:inputText id="updateCustomerCompany" value="#{customerManageAction.updateCustomer.customerCompany}"  maxlength="30"/>
					</td><td>
						<h:outputLabel for="updateCustomerState" value="客户状态："/>
					</td><td>
						<h:selectOneMenu id="updateCustomerState" value="#{customerManageAction.updateCustomer.customerState}" style="width: 170px;font-weight: bold">  
			                <f:selectItems value="#{customerManageAction.customerStateItems}"/>
			            </h:selectOneMenu>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="updateCustomerDesc" value="备注："/>
					</td><td colspan="3">
						<p:inputTextarea id="updateCustomerDesc" value="#{customerManageAction.updateCustomer.customerDesc}" rows="1" autoResize="false" maxlength="100" style="width:430px"/>
					</td></tr>
				</table>
		</p:outputPanel>
		<f:facet name="footer">
			<p:commandButton value="更新" action="#{customerManageAction.updateCustomer}"
				  oncomplete="if(this.args.error){ alert(this.args.error);}else{alert(this.args.msg);updateCustomerDlg.hide();}"  update=":form:customerTable"/>
		</f:facet>
	</p:dialog>
	
	<!-- 新增客户 -->
	<p:dialog id="addCustomerDlgID" header="新增客户" widgetVar="addCustomerDlg" modal="true" resizable="false" >
		<p:outputPanel id="addCustomerPanel" style="width: 100%" >
				<table>
					<tr><td>
						<h:outputLabel for="addCustomerCode" value="客户编码："/>
					</td><td>
						<p:inputText id="addCustomerCode" value="#{customerManageAction.addCustomer.customerCode}"  maxlength="30"/>
					</td><td colspan="2">
						<H5 style="color:RED;margin: 0px">客户编号为登录系统的帐户名，不可修改！</H5>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="addCustomerName" value="客户名称："/>
					</td><td>
						<p:inputText id="addCustomerName" value="#{customerManageAction.addCustomer.customerName}" maxlength="30"/>
					</td><td>
						<h:outputLabel for="addCustomerRegion" value="客户地区："/>
					</td><td>
						<p:inputText id="addCustomerRegion" value="#{customerManageAction.addCustomer.customerRegion}"  maxlength="50"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="addCustomerLandlinePhone" value="客户座机："/>
					</td><td>
						<p:inputText id="addCustomerLandlinePhone" value="#{customerManageAction.addCustomer.customerLandlinePhone}"  maxlength="20"/>
					</td><td>
						<h:outputLabel for="addCustomerCellphone" value="客户手机："/>
					</td><td>
						<p:inputText id="addCustomerCellphone" value="#{customerManageAction.addCustomer.customerCellphone}"  maxlength="20"/>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="addCustomerCompany" value="公司名称："/>
					</td><td>
						<p:inputText id="addCustomerCompany" value="#{customerManageAction.addCustomer.customerCompany}"  maxlength="30"/>
					</td><td>
						<h:outputLabel for="addCustomerState" value="客户状态："/>
					</td><td>
						<h:selectOneMenu id="addCustomerState" value="#{customerManageAction.addCustomer.customerState}" style="width: 170px;font-weight: bold">  
			                <f:selectItems value="#{customerManageAction.customerStateItems}"/>
			            </h:selectOneMenu>
					</td></tr>
					<tr style="height: 5px"></tr>
					<tr><td>
						<h:outputLabel for="addCustomerDesc" value="备注："/>
					</td><td colspan="3">
						<p:inputTextarea id="addCustomerDesc" value="#{customerManageAction.addCustomer.customerDesc}" rows="1" autoResize="false" maxlength="100" style="width:430px"/>
					</td></tr>
				</table>
		</p:outputPanel>
		<f:facet name="footer">
			<p:commandButton value="保存" action="#{customerManageAction.saveCustomer}"
				  oncomplete="if(this.args.error){ alert(this.args.error);}else{alert(this.args.msg);addCustomerDlg.hide();}"  update=":form:customerTable"/>
		</f:facet>
	</p:dialog>
</ui:composition>